package com.hzh.util

import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.fs.{FileSystem, Path}

object HdfsUtil {

  /**
   * 在保存数据之前删除hdfs中已存在的路径
   */

  def delete(path: String): Unit = {
    val conf = new Configuration()
    val fileSystem: FileSystem = FileSystem.get(conf)
    if (fileSystem.exists(new Path(path))) {
      fileSystem.delete(new Path(path), true)
    }
  }


}
